import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:xiaomi_shop/app/services/screenAdapter.dart';

import '../controllers/pay_controller.dart';

class PayView extends GetView<PayController> {
  const PayView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('去支付'),
          centerTitle: true,
        ),
        body: ListView(
          children: [
            ListTile(
              leading: SizedBox(
                width: ScreenAdapter.width(80),
                height: ScreenAdapter.height(80),
                child: Image.asset(
                  "assets/images/btn_home_zhifubao.png",
                  fit: BoxFit.contain,
                ),
              ),
              title: Text("支付宝"),
              trailing: Obx(() => Checkbox(
                    shape: CircleBorder(),
                    activeColor: Colors.orange.shade900,
                    value: controller.zhifubao.value,
                    onChanged: (value) {
                      controller.zhifubao.value = !controller.zhifubao.value;
                    },
                  )),
            ),
            ListTile(
              leading: SizedBox(
                width: ScreenAdapter.width(80),
                height: ScreenAdapter.height(80),
                child: Image.asset(
                  "assets/images/btn_home_weixin.png",
                  fit: BoxFit.contain,
                ),
              ),
              title: Text("微信"),
              trailing: Obx(() => Checkbox(
                    shape: CircleBorder(),
                    activeColor: Colors.orange.shade900,
                    value: !controller.zhifubao.value,
                    onChanged: (value) {
                      controller.zhifubao.value = !controller.zhifubao.value;
                    },
                  )),
            ),
            SizedBox(
              height: ScreenAdapter.height(60),
            ),
            Container(
              margin: EdgeInsets.only(
                  top: ScreenAdapter.height(20),
                  left: ScreenAdapter.height(80),
                  right: ScreenAdapter.height(80)),
              height: ScreenAdapter.height(136),
              child: ElevatedButton(
                  style: ButtonStyle(
                      backgroundColor: MaterialStatePropertyAll(Colors.red),
                      foregroundColor: MaterialStatePropertyAll(Colors.white),
                      textStyle: MaterialStatePropertyAll(TextStyle(
                          fontSize: ScreenAdapter.fontSize(40),
                          fontWeight: FontWeight.bold))),
                  onPressed: () async {},
                  child: const Text("支付")),
            ),
          ],
        ));
  }
}
